(function(){function t(t,e){this.editor=t;this.bShown=false;this.closedWidth=20;this.MIN_CLOSED_WIDTH=120;this.width=this.editor.config.taskbarWidth||250;this.taskbars={};this.freezeOnclickHandler=false;if(e){this.Init()}}t.prototype={Init:function(){this.pCont=this.editor.dom.taskbarCont;this.pCont.setAttribute("data-bx-type","taskbarmanager");this.pResizer=BX("bx-html-editor-tskbr-res-"+this.editor.id);this.pResizer.setAttribute("data-bx-type","taskbarflip");this.pTopCont=BX("bx-html-editor-tskbr-top-"+this.editor.id);BX.bind(this.pResizer,"mousedown",BX.proxy(this.StartResize,this));BX.bind(this.pCont,"click",BX.proxy(this.OnClick,this));this.pSearchCont=BX("bxhed-tskbr-search-cnt-"+this.editor.id);this.pSearchAli=BX("bxhed-tskbr-search-ali-"+this.editor.id);this.pSearchInput=BX("bxhed-tskbr-search-inp-"+this.editor.id);this.pSearchNothingNotice=BX("bxhed-tskbr-search-nothing-"+this.editor.id);BX.bind(this.pSearchInput,"keyup",BX.proxy(this.TaskbarSearch,this))},OnClick:function(t){if(!t)t=window.event;if(this.freezeOnclickHandler)return;var e=this,i=t.target||t.srcElement,s=i&&i.getAttribute?i.getAttribute("data-bx-type"):null;if(!s){i=BX.findParent(i,(function(t){return t==e.pCont||t.getAttribute&&t.getAttribute("data-bx-type")}),this.pCont);s=i&&i.getAttribute?i.getAttribute("data-bx-type"):null}if(s=="taskbarflip"||!this.bShown&&(s=="taskbarmanager"||!s)){if(this.bShown){this.Hide()}else{this.Show()}}else if(s=="taskbargroup_title"){BX.onCustomEvent(this,"taskbargroupTitleClick",[i])}else if(s=="taskbarelement"){BX.onCustomEvent(this,"taskbarelementClick",[i])}else if(s=="taskbar_title_but"){BX.onCustomEvent(this,"taskbarTitleClick",[i])}else if(s=="taskbar_top_menu"){BX.onCustomEvent(this,"taskbarMenuClick",[i])}else if(s=="taskbar_search_cancel"){this.pSearchInput.value="";this.TaskbarSearch()}},Show:function(t){if(!this.bShown){this.bShown=true;this.pCont.className="bxhtmled-taskbar-cnt bxhtmled-taskbar-shown"}this.pCont.style.width=this.GetWidth(true)+"px";this.editor.ResizeSceleton();if(t!==false){this.editor.SaveOption("taskbar_shown",1)}},Hide:function(t){if(this.bShown){this.bShown=false;this.pCont.className="bxhtmled-taskbar-cnt bxhtmled-taskbar-hidden"}this.pCont.style.width=this.GetWidth()+"px";this.editor.ResizeSceleton();if(t!==false){this.editor.SaveOption("taskbar_shown",0)}},GetWidth:function(t,e){var i;if(this.bShown){i=t?Math.max(this.width,this.closedWidth+this.MIN_CLOSED_WIDTH):this.width;if(e&&i>e){i=this.width=Math.round(e)}}else{i=this.closedWidth}return i},AddTaskbar:function(t){this.taskbars[t.id]=t;this.pCont.appendChild(t.GetCont());this.pTopCont.appendChild(t.GetTitleCont())},ShowTaskbar:function(t){this.pSearchInput.value="";for(var e in this.taskbars){if(this.taskbars.hasOwnProperty(e)){if(e==t){this.taskbars[e].Activate();this.pSearchInput.placeholder=this.taskbars[e].searchPlaceholder}else{this.taskbars[e].Deactivate()}this.activeTaskbarId=t;this.taskbars[e].ClearSearchResult()}}},GetActiveTaskbar:function(){return this.taskbars[this.activeTaskbarId]},StartResize:function(t){if(!t)t=window.event;var e=t.target||t.srcElement;if(e.getAttribute("data-bx-tsk-split-but")=="Y")return true;this.freezeOnclickHandler=true;var i=this.GetWidth(),s=this.editor.dom.resizerOverlay,o=0,n,a=BX.GetWindowScrollPos(),r=t.clientX+a.scrollLeft,l=this;s.style.display="block";function h(t,e){if(!t)t=window.event;var s=t.clientX+a.scrollLeft;if(r==s)return;o=r-s;n=i+o;if(e){l.width=Math.max(n,l.closedWidth+l.MIN_CLOSED_WIDTH);if(isNaN(l.width)){l.width=l.closedWidth+l.MIN_CLOSED_WIDTH}}else{l.width=n}if(n>l.closedWidth+(e?20:0)){l.Show()}else{l.Hide()}}function d(t){h(t,true);BX.unbind(document,"mousemove",h);BX.unbind(document,"mouseup",d);s.style.display="none";setTimeout((function(){l.freezeOnclickHandler=false}),10);BX.PreventDefault(t);l.editor.SaveOption("taskbar_width",l.GetWidth(true))}BX.bind(document,"mousemove",h);BX.bind(document,"mouseup",d)},Resize:function(t,e){var i=parseInt(this.pTopCont.offsetHeight,10);for(var s in this.taskbars){if(this.taskbars.hasOwnProperty(s)&&this.taskbars[s].pTreeCont){this.taskbars[s].pTreeCont.style.height=e-i-42+"px"}}this.pSearchCont.style.width=t+"px";if(!BX.browser.IsDoctype()){this.pSearchAli.style.width=t-20+"px"}var o=this;if(this.resizeTimeout){this.resizeTimeout=clearTimeout(this.resizeTimeout)}this.resizeTimeout=setTimeout((function(){if(parseInt(o.pTopCont.offsetHeight,10)!==i){o.Resize(t,e)}}),100)},TaskbarSearch:function(t){var e=this.GetActiveTaskbar(),i=this.pSearchInput.value;if(t&&t.keyCode==this.editor.KEY_CODES["escape"]){i=this.pSearchInput.value=""}if(i.length<2){e.ClearSearchResult()}else{e.Search(i)}}};function e(t){this.editor=t;this.manager=this.editor.taskbarManager;this.searchIndex=[];this._searchResult=[];this._searchResultSect=[];BX.addCustomEvent(this.manager,"taskbargroupTitleClick",BX.proxy(this.OnGroupTitleClick,this));BX.addCustomEvent(this.manager,"taskbarelementClick",BX.proxy(this.OnElementClick,this));BX.addCustomEvent(this.manager,"taskbarTitleClick",BX.proxy(this.OnTitleClick,this));BX.addCustomEvent(this.manager,"taskbarMenuClick",BX.proxy(this.OnMenuClick,this))}e.prototype={GetCont:function(){return this.pTreeCont},GetTitleCont:function(){return this.pTitleCont},BuildSceleton:function(){this.pTitleCont=BX.create("span",{props:{className:"bxhtmled-split-btn"},html:'<span class="bxhtmled-split-btn-l"><span class="bxhtmled-split-btn-bg">'+this.title+'</span></span><span class="bxhtmled-split-btn-r"><span data-bx-type="taskbar_top_menu" data-bx-taskbar="'+this.id+'" class="bxhtmled-split-btn-bg"></span></span>'});this.pTitleCont.setAttribute("data-bx-type","taskbar_title_but");this.pTitleCont.setAttribute("data-bx-taskbar",this.id);this.pTreeCont=BX.create("DIV",{props:{className:"bxhtmled-taskbar-tree-cont"}});this.pTreeInnerCont=this.pTreeCont.appendChild(BX.create("DIV",{props:{className:"bxhtmled-taskbar-tree-inner-cont"}}))},BuildTree:function(t,e){BX.cleanNode(this.pTreeCont);this.treeSectionIndex={};this.BuildTreeSections(t);this.BuildTreeElements(e)},BuildTreeSections:function(t){this.sections=[];for(var e=0;e<t.length;e++){this.BuildSection(t[e])}},GetSectionsTreeInfo:function(){return this.sections},BuildSection:function(t){var e=this.GetSectionContByPath(t.path),i=BX.create("DIV",{props:{className:"bxhtmled-tskbr-sect-outer"}}),s=i.appendChild(BX.create("DIV",{props:{className:"bxhtmled-tskbr-sect"}})),o=s.appendChild(BX.create("SPAN",{props:{className:"bxhtmled-tskbr-sect-icon"}})),n=s.appendChild(BX.create("SPAN",{props:{className:"bxhtmled-tskbr-sect-title"},text:t.title||t.name})),a=i.appendChild(BX.create("DIV",{props:{className:"bxhtmled-tskb-child"}})),r=i.appendChild(BX.create("DIV",{props:{className:"bxhtmled-tskb-child-elements"}}));var l=t.path==""?t.name:t.path+","+t.name;var h=t.path==""?0:1;var d={key:l,children:[],section:t};this.treeSectionIndex[l]={icon:o,outerCont:i,cont:s,childCont:a,elementsCont:r,sect:d};this.GetSectionByPath(t.path).push(d);if(h>0){BX.addClass(s,"bxhtmled-tskbr-sect-"+h);BX.addClass(o,"bxhtmled-tskbr-sect-icon-"+h)}s.setAttribute("data-bx-type","taskbargroup_title");s.setAttribute("data-bx-taskbar",this.id);i.setAttribute("data-bx-type","taskbargroup");i.setAttribute("data-bx-path",l);i.setAttribute("data-bx-taskbar",this.id);e.appendChild(i)},BuildTreeElements:function(t){this.elements=t;for(var e in t){if(t.hasOwnProperty(e)){this.BuildElement(t[e])}}},BuildElement:function(t){const e=this;const i=this.GetSectionContByPath(t.key||t.path,true);const s=BX.create("DIV",{props:{className:"bxhtmled-tskbr-element"},html:'<span class="bxhtmled-tskbr-element-icon"></span><span class="bxhtmled-tskbr-element-text">'+BX.Text.encode(t.title)+"</span>"});var o=s.appendChild(BX.create("IMG",{props:{src:this.editor.util.GetEmptyImage(),className:"bxhtmled-drag"}}));this.HandleElementEx(s,o,t);this.searchIndex.push({content:(BX.Text.encode(t.title)+" "+t.name).toLowerCase(),element:s});o.onmousedown=function(t){if(!t){t=window.event}var i=t.target||t.srcElement,s=e.editor.GetBxTag(i);return e.OnElementMouseDownEx(t,i,s)};o.ondblclick=function(t){var i=t.target||t.srcElement,s=e.editor.GetBxTag(i);return e.OnElementDoubleClick(t,i,s)};o.ondragend=function(t){if(!t){t=window.event}e.OnDragEndHandler(t,this)};s.setAttribute("data-bx-type","taskbarelement");i.appendChild(s)},HandleElementEx:function(t){},GetSectionContByPath:function(t,e){if(t==""||!this.treeSectionIndex[t]){return this.pTreeCont}else{return e?this.treeSectionIndex[t].elementsCont:this.treeSectionIndex[t].childCont}},GetSectionByPath:function(t){if(t==""||!this.treeSectionIndex[t]){return this.sections}else{return this.treeSectionIndex[t].sect.children}},ToggleGroup:function(t,e){var i=t.getAttribute("data-bx-path");if(i){var s=this.treeSectionIndex[i];if(!s){return}if(e!==undefined){s.opened=!e}if(s.opened){BX.removeClass(s.cont,"bxhtmled-tskbr-sect-open");BX.removeClass(s.icon,"bxhtmled-tskbr-sect-icon-open");BX.removeClass(s.outerCont,"bxhtmled-tskbr-sect-outer-open");s.childCont.style.display="none";s.elementsCont.style.display="none";s.opened=false}else{BX.addClass(s.cont,"bxhtmled-tskbr-sect-open");BX.addClass(s.icon,"bxhtmled-tskbr-sect-icon-open");BX.addClass(s.outerCont,"bxhtmled-tskbr-sect-outer-open");s.childCont.style.display="block";s.elementsCont.style.display=s.elementsCont.childNodes.length>0?"block":"none";s.opened=true}}},OnDragEndHandler:function(t,e){var i=this;this.editor.skipPasteHandler=true;this.editor.skipPasteControl=true;if(this.editor.iframeView.pasteHandlerTimeout)this.editor.iframeView.pasteHandlerTimeout=clearTimeout(this.editor.iframeView.pasteHandlerTimeout);setTimeout((function(){var t=i.editor.GetIframeElement(e.id);if(t&&t.parentNode){var s=i.editor.util.CheckSurrogateNode(t.parentNode);if(s){i.editor.util.InsertAfter(t,s)}}i.editor.synchro.FullSyncFromIframe();i.editor.skipPasteHandler=false;i.editor.skipPasteControl=false;i.editor.iframeView.pasteLoader.hide()}),20)},OnElementMouseDownEx:function(t){return true},OnElementClick:function(t){this.OnElementClickEx();return true},OnElementClickEx:function(){return true},OnElementDoubleClick:function(t,e,i){if(e){var s=e.cloneNode(true);this.editor.Focus();this.editor.selection.InsertNode(s);this.editor.synchro.FullSyncFromIframe()}},OnGroupTitleClick:function(t){if(t&&t.getAttribute("data-bx-taskbar")==this.id){return this.ToggleGroup(t.parentNode)}return true},OnTitleClick:function(t){if(t&&t.getAttribute("data-bx-taskbar")==this.id){return this.manager.ShowTaskbar(this.id)}return true},OnMenuClick:function(t){if(t&&t.getAttribute("data-bx-taskbar")==this.id)return this.ShowMenu(t);return true},Activate:function(){this.pTreeCont.style.display="block";this.bActive=true;return true},Deactivate:function(){this.pTreeCont.style.display="none";this.bActive=false;return true},IsActive:function(){return!!this.bActive},ShowMenu:function(t){var e=this.GetMenuItems();BX.PopupMenu.destroy(this.uniqueId+"_menu");BX.PopupMenu.show(this.uniqueId+"_menu",t,e,{overlay:{opacity:.1},events:{onPopupClose:function(){BX.removeClass(this.bindElement,"bxec-add-more-over")}},offsetLeft:1,zIndex:3005});return true},GetMenuItems:function(){return[]},Search:function(t){this.ClearSearchResult();var e=false,i,s,o,n=this.searchIndex.length;t=BX.util.trim(t.toLowerCase());BX.addClass(this.pTreeCont,"bxhtmled-taskbar-tree-cont-search");BX.addClass(this.manager.pSearchCont,"bxhtmled-search-cont-res");for(o=0;o<n;o++){s=this.searchIndex[o];if(s.content.indexOf(t)!==-1){e=true;BX.addClass(s.element,"bxhtmled-tskbr-search-res");this._searchResult.push(s.element);i=BX.findParent(s.element,(function(t){return t.getAttribute&&t.getAttribute("data-bx-type")=="taskbargroup"}),this.pTreeCont);while(i){BX.addClass(i,"bxhtmled-tskbr-search-res");this.ToggleGroup(i,true);this._searchResultSect.push(i);i=BX.findParent(i,(function(t){return t.getAttribute&&t.getAttribute("data-bx-type")=="taskbargroup"}),this.pTreeCont)}}}if(!e){this.manager.pSearchNothingNotice.style.display="block"}},ClearSearchResult:function(){BX.removeClass(this.pTreeCont,"bxhtmled-taskbar-tree-cont-search");BX.removeClass(this.manager.pSearchCont,"bxhtmled-search-cont-res");this.manager.pSearchNothingNotice.style.display="none";var t;if(this._searchResult){for(t=0;t<this._searchResult.length;t++){BX.removeClass(this._searchResult[t],"bxhtmled-tskbr-search-res")}this._searchResult=[]}if(this._searchResultSect){for(t=0;t<this._searchResultSect.length;t++){BX.removeClass(this._searchResultSect[t],"bxhtmled-tskbr-search-res");this.ToggleGroup(this._searchResultSect[t],false)}this._searchResultSect=[]}},GetId:function(){return this.id}};function i(t){i.superclass.constructor.apply(this,arguments);this.id="components";this.title=BX.message("ComponentsTitle");this.templateId=this.editor.templateId;this.uniqueId="taskbar_"+this.editor.id+"_"+this.id;this.searchPlaceholder=BX.message("BXEdCompSearchPlaceHolder");this.Init()}BX.extend(i,e);i.prototype.Init=function(){this.BuildSceleton();var t=this.editor.components.GetList();this.BuildTree(t.groups,t.items)};i.prototype.HandleElementEx=function(t,e,i){this.editor.SetBxTag(e,{tag:"component_icon",params:i});if(i.complex=="Y"){i.className="bxhtmled-surrogate-green";BX.addClass(t,"bxhtmled-tskbr-element-green");t.title=BX.message("BXEdComplexComp")}};i.prototype.OnElementMouseDownEx=function(t,e,i){if(!i||i.tag!=="component_icon"){return false}this.editor.components.LoadParamsList({name:i.params.name})};i.prototype.GetMenuItems=function(){var t=this;return[{text:BX.message("RefreshTaskbar"),title:BX.message("RefreshTaskbar"),className:"",onclick:function(){t.editor.componentsTaskbar.ClearSearchResult();t.editor.components.ReloadList();BX.PopupMenu.destroy(t.uniqueId+"_menu")}}]};function s(t,e){this.editor=t;this.id=e.id;this.params=e;this.className="bxhtmled-dialog"+(e.className?" "+e.className:"");this.zIndex=e.zIndex||3008;this.firstFocus=false;this.Init()}s.prototype={Init:function(){var t=this,e={title:this.params.title||this.params.name||"",width:this.params.width||600,resizable:false};if(this.params.resizable){e.resizable=true;e.min_width=this.params.min_width||400;e.min_height=this.params.min_height||250;e.resize_id=this.params.resize_id||this.params.id+"_res"}this.oDialog=new BX.CDialog(e);e.height=this.params.height||false;BX.addCustomEvent(this.oDialog,"onWindowResize",BX.proxy(this.OnResize,this));BX.addCustomEvent(this.oDialog,"onWindowResizeFinished",BX.proxy(this.OnResizeFinished,this));BX.addClass(this.oDialog.PARTS.CONTENT,this.className);if(!e.height){this.oDialog.PARTS.CONTENT_DATA.style.height=null}this.oDialog.SetButtons([new BX.CWindowButton({title:BX.message("DialogSave"),className:"adm-btn-save",action:function(){BX.onCustomEvent(t,"OnDialogSave");t.oDialog.Close()}}),this.oDialog.btnCancel]);BX.addCustomEvent(this.oDialog,"onWindowUnRegister",(function(){BX.unbind(window,"keydown",BX.proxy(t.OnKeyDown,t));t.dialogShownTimeout=setTimeout((function(){t.editor.dialogShown=false}),300);t.RestoreWindowOverflow()}))},Show:function(){var t=this;this.editor.dialogShown=true;if(this.dialogShownTimeout){this.dialogShownTimeout=clearTimeout(this.dialogShownTimeout)}this.oDialog.Show();var e=parseInt(this.oDialog.DIV.style.top)-180,i=BX.GetWindowScrollPos(document),s=i.scrollTop,o=s+50;this.oDialog.DIV.style.top=(e>o?e:o)+"px";BX.bind(window,"keydown",BX.proxy(this.OnKeyDown,this));this.savedBodyOverflow=this.savedScrollLeft=this.savedScrollTop=false;setTimeout((function(){if(BX.browser.IsOpera())t.oDialog.Move(1,1);t.oDialog.__resizeOverlay();if(t.firstFocus){BX.focus(t.firstFocus);if(t.selectFirstFocus)t.firstFocus.select()}}),100)},BuildTabControl:function(t,e){var i,s=BX.create("DIV",{props:{className:"bxhtmled-dlg-tabs-wrap"}}),o=BX.create("DIV",{props:{className:"bxhtmled-dlg-cont-wrap"}});for(i=0;i<e.length;i++){e[i].tab=s.appendChild(BX.create("SPAN",{props:{className:"bxhtmled-dlg-tab"+(i==0?" bxhtmled-dlg-tab-active":"")},attrs:{"data-bx-dlg-tab-ind":i.toString()},text:e[i].name}));e[i].cont=o.appendChild(BX.create("DIV",{props:{className:"bxhtmled-dlg-cont"},style:{display:i==0?"":"none"}}))}BX.bind(s,"click",(function(t){var s,o=t.target||t.srcElement;if(o&&o.getAttribute){s=parseInt(o.getAttribute("data-bx-dlg-tab-ind"));if(!isNaN(s)){for(i=0;i<e.length;i++){if(i==s){e[i].cont.style.display="";BX.addClass(e[i].tab,"bxhtmled-dlg-tab-active")}else{e[i].cont.style.display="none";BX.removeClass(e[i].tab,"bxhtmled-dlg-tab-active")}}}}}));t.appendChild(s);t.appendChild(o);return{cont:t,tabsWrap:s,contWrap:o,tabs:e}},OnKeyDown:function(t){if(t.keyCode==13&&this.closeByEnter!==false){var e=t.target||t.srcElement;if(e&&e.nodeName!=="TEXTAREA"){this.oDialog.PARAMS.buttons[0].emulate()}}},SetContent:function(t){return this.oDialog.SetContent(t)},SetTitle:function(t){return this.oDialog.SetTitle(t)},OnResize:function(){},OnResizeFinished:function(){},GetContentSize:function(){return{width:this.oDialog.PARTS.CONTENT_DATA.offsetWidth,height:this.oDialog.PARTS.CONTENT_DATA.offsetHeight}},Save:function(){if(this.savedRange){this.editor.selection.SetBookmark(this.savedRange)}if(this.action&&this.editor.action.IsSupported(this.action)){this.editor.action.Exec(this.action,this.GetValues())}},Close:function(){if(this.IsOpen()){this.oDialog.Close()}},IsOpen:function(){return this.oDialog.isOpen},DisableKeyCheck:function(){this.closeByEnter=false;BX.WindowManager.disableKeyCheck()},EnableKeyCheck:function(){var t=this;setTimeout((function(){t.closeByEnter=true;BX.WindowManager.enableKeyCheck()}),200)},AddTableRow:function(t,e){var i,s,o;i=t.insertRow(-1);s=i.insertCell(-1);s.className="bxhtmled-left-c";if(e&&e.label){s.appendChild(BX.create("LABEL",{props:{className:e.required?"bxhtmled-req":""},text:e.label})).setAttribute("for",e.id)}o=i.insertCell(-1);o.className="bxhtmled-right-c";return{row:i,leftCell:s,rightCell:o}},SetValues:BX.DoNothing,GetValues:BX.DoNothing,CheckSize:function(t){var e=this;if(this.checkSizeTimeout)this.checkSizeTimeout=clearTimeout(this.checkSizeTimeout);if(t!==true){this.checkSizeTimeout=setTimeout((function(){e.CheckSize(true)}),50);return}var i=BX.GetWindowInnerSize(document),s=this.oDialog.DIV.offsetHeight+50;if(s>=i.innerHeight){var o=BX.GetWindowScrollPos(document);this.savedBodyOverflow=document.body.style.overflow;this.savedScrollTop=o.scrollTop;this.savedScrollLeft=o.scrollLeft;document.body.style.overflow="auto";if(this.editor.expanded)BX.unbind(window,"scroll",BX.proxy(this.editor.PreventScroll,this.editor))}else{this.RestoreWindowOverflow()}},RestoreWindowOverflow:function(){if(this.savedBodyOverflow!==false){document.body.style.overflow=this.savedBodyOverflow;this.savedBodyOverflow=false}if(this.savedScrollTop!==false){window.scrollTo(this.savedScrollLeft,this.savedScrollTop);this.savedScrollLeft=this.savedScrollTop=false}if(this.editor.expanded)BX.bind(window,"scroll",BX.proxy(this.editor.PreventScroll,this.editor))}};function o(t){this.editor=t;BX.addCustomEvent(this.editor,"OnIframeContextMenu",BX.delegate(this.Show,this));this.Init()}o.prototype={Init:function(){var t=this,e={TEXT:BX.message("ContMenuDefProps"),ACTION:function(){t.editor.selection.SetBookmark(t.savedRange);t.editor.GetDialog("Default").Show(false,t.savedRange);t.Hide()}};this.items={php:[{TEXT:BX.message("BXEdContMenuPhpCode"),ACTION:function(){var e=t.GetTargetItem();if(e&&e.php){t.editor.GetDialog("Source").Show(e.php.bxTag)}t.Hide()}}],anchor:[{TEXT:BX.message("BXEdEditAnchor"),ACTION:function(){var e=t.GetTargetItem();if(e&&e.anchor){t.editor.GetDialog("Anchor").Show(e.anchor.bxTag)}t.Hide()}}],javascript:[{TEXT:BX.message("BXEdContMenuJavascript"),ACTION:function(){var e=t.GetTargetItem();if(e&&e.javascript){t.editor.GetDialog("Source").Show(e.javascript.bxTag)}t.Hide()}}],htmlcomment:[{TEXT:BX.message("BXEdContMenuHtmlComment"),ACTION:function(){var e=t.GetTargetItem();if(e&&e.htmlcomment){t.editor.GetDialog("Source").Show(e.htmlcomment.bxTag)}t.Hide()}}],iframe:[{TEXT:BX.message("BXEdContMenuIframe"),ACTION:function(){var e=t.GetTargetItem();if(e&&e.iframe){t.editor.GetDialog("Source").Show(e.iframe.bxTag)}t.Hide()}}],style:[{TEXT:BX.message("BXEdContMenuStyle"),ACTION:function(){var e=t.GetTargetItem();if(e&&e.style){t.editor.GetDialog("Source").Show(e.style.bxTag)}t.Hide()}}],object:[{TEXT:BX.message("BXEdContMenuObject"),ACTION:function(){var e=t.GetTargetItem();if(e&&e.object){t.editor.GetDialog("Source").Show(e.object.bxTag)}t.Hide()}}],component:[{TEXT:BX.message("BXEdContMenuComponent"),ACTION:function(){var e=t.GetTargetItem();if(e&&e.component){t.editor.components.ShowPropertiesDialog(e.component.bxTag.params,t.editor.GetBxTag(e.component.bxTag.surrogateId))}t.Hide()}},{TEXT:BX.message("BXEdContMenuComponentRemove"),ACTION:function(){var e=t.GetTargetItem();if(e&&e.component){BX.remove(e.component.element)}t.Hide()}}],printbreak:[{TEXT:BX.message("NodeRemove"),ACTION:function(e){var i=t.GetTargetItem("printbreak");if(i&&i.element){t.editor.selection.RemoveNode(i.element)}t.Hide()}}],video:[{TEXT:BX.message("BXEdVideoProps"),bbMode:true,ACTION:function(){var e=t.GetTargetItem("video");if(e){t.editor.GetDialog("Video").Show(e.bxTag)}t.Hide()}},{TEXT:BX.message("BXEdVideoDel"),bbMode:true,ACTION:function(e){var i=t.GetTargetItem("video");if(i&&i.element){t.editor.selection.RemoveNode(i.element)}t.Hide()}}],smile:[],A:[{TEXT:BX.message("ContMenuLinkEdit"),bbMode:true,ACTION:function(){var e=t.GetTargetItem("A");if(e){t.editor.GetDialog("Link").Show([e],this.savedRange)}t.Hide()}},{TEXT:BX.message("ContMenuLinkDel"),bbMode:true,ACTION:function(){var e=t.GetTargetItem("A");if(e&&t.editor.action.IsSupported("removeLink")){t.editor.action.Exec("removeLink",[e])}t.Hide()}}],IMG:[{TEXT:BX.message("ContMenuImgEdit"),bbMode:true,ACTION:function(){var e=t.GetTargetItem("IMG");if(e){t.editor.GetDialog("Image").Show([e],t.savedRange)}t.Hide()}},{TEXT:BX.message("ContMenuImgDel"),bbMode:true,ACTION:function(){var e=t.GetTargetItem("IMG");if(e){t.editor.selection.RemoveNode(e)}t.Hide()}}],DIV:[{TEXT:BX.message("ContMenuCleanDiv"),title:BX.message("ContMenuCleanDiv_Title"),ACTION:function(){var e=t.GetTargetItem("DIV");if(e){t.editor.On("OnHtmlContentChangedByControl");t.editor.util.ReplaceWithOwnChildren(e);t.editor.synchro.FullSyncFromIframe()}t.Hide()}},e],TABLE:[{TEXT:BX.message("BXEdTableInsertMenu"),HIDE_ITEM:function(){var e=t.editor.action.actions.tableOperation.getSelectedCells(t.savedRange,t.GetTargetItem("TABLE"));return!e||e.length!=1},MENU:[{TEXT:BX.message("BXEdTableInsColLeft"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"insertColumnLeft",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()}},{TEXT:BX.message("BXEdTableInsColRight"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"insertColumnRight",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()}},{TEXT:BX.message("BXEdTableInsRowUpper"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"insertRowUpper",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()}},{TEXT:BX.message("BXEdTableInsRowLower"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"insertRowLower",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()}},{TEXT:BX.message("BXEdTableInsCellBefore"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"insertCellLeft",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()}},{TEXT:BX.message("BXEdTableInsCellAfter"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"insertCellRight",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()}}]},{TEXT:BX.message("BXEdTableRemoveMenu"),MENU:[{TEXT:BX.message("BXEdTableDelCol"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"removeColumn",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()},HIDE_ITEM:function(){var e=t.editor.action.actions.tableOperation.getSelectedCells(t.savedRange,t.GetTargetItem("TABLE"));return!e||e.length!=1}},{TEXT:BX.message("BXEdTableDelRow"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"removeRow",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()},HIDE_ITEM:function(){var e=t.editor.action.actions.tableOperation.getSelectedCells(t.savedRange,t.GetTargetItem("TABLE"));return!e||e.length!=1}},{TEXT:BX.message("BXEdTableDellCell"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"removeCell",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()},HIDE_ITEM:function(){var e=t.editor.action.actions.tableOperation.getSelectedCells(t.savedRange,t.GetTargetItem("TABLE"));return!e||e.length!=1}},{TEXT:BX.message("BXEdTableDellSelectedCells"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"removeSelectedCells",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()},HIDE_ITEM:function(){var e=t.editor.action.actions.tableOperation.getSelectedCells(t.savedRange,t.GetTargetItem("TABLE"));return!e||e.length===1}}]},{TEXT:BX.message("BXEdTableMergeMenu"),MENU:[{TEXT:BX.message("BXEdTableMergeSelectedCells"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"mergeSelectedCells",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()},HIDE_ITEM:function(){if(!t.savedRange.collapsed){return!t.editor.action.actions.tableOperation.canBeMerged(false,t.savedRange,t.GetTargetItem("TABLE"))}return true}},{TEXT:BX.message("BXEdTableMergeRight"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"mergeRightCell",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()},HIDE_ITEM:function(){return!t.editor.action.actions.tableOperation.canBeMergedWithRight(t.savedRange,t.GetTargetItem("TABLE"))}},{TEXT:BX.message("BXEdTableMergeBottom"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"mergeBottomCell",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()},HIDE_ITEM:function(){return!t.editor.action.actions.tableOperation.canBeMergedWithBottom(t.savedRange,t.GetTargetItem("TABLE"))}},{TEXT:BX.message("BXEdTableMergeRowCells"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"mergeRow",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()},HIDE_ITEM:function(){var e=t.editor.action.actions.tableOperation.getSelectedCells(t.savedRange,t.GetTargetItem("TABLE"));return!e||e.length>1}},{TEXT:BX.message("BXEdTableMergeColCells"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"mergeColumn",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()},HIDE_ITEM:function(){var e=t.editor.action.actions.tableOperation.getSelectedCells(t.savedRange,t.GetTargetItem("TABLE"));return!e||e.length>1}}]},{TEXT:BX.message("BXEdTableSplitMenu"),HIDE_ITEM:function(){var e=t.editor.action.actions.tableOperation.getSelectedCells(t.savedRange,t.GetTargetItem("TABLE"));return!e||e.length!=1},MENU:[{TEXT:BX.message("BXEdTableSplitCellHor"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"splitHorizontally",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()}},{TEXT:BX.message("BXEdTableSplitCellVer"),ACTION:function(){t.editor.action.Exec("tableOperation",{actionType:"splitVertically",tableNode:t.GetTargetItem("TABLE"),range:t.savedRange});t.Hide()}}]},{SEPARATOR:true},{TEXT:BX.message("BXEdTableTableCellProps"),ACTION:function(){var e=t.GetTargetItem("TABLE");if(e){var i=t.editor.action.actions.tableOperation.getSelectedCells(t.savedRange,t.GetTargetItem("TABLE"));t.editor.GetDialog("Default").Show(i,t.savedRange)}t.Hide()},HIDE_ITEM:function(){var e=t.editor.action.actions.tableOperation.getSelectedCells(t.savedRange,t.GetTargetItem("TABLE"));return!e||e.length!=1}},{TEXT:BX.message("BXEdTableTableProps"),ACTION:function(){var e=t.GetTargetItem("TABLE");if(e){t.editor.GetDialog("Table").Show([e],t.savedRange)}t.Hide()}},{TEXT:BX.message("BXEdTableDeleteTable"),bbMode:true,ACTION:function(){var e=t.GetTargetItem("TABLE");if(e){t.editor.selection.RemoveNode(e)}t.Hide()}}],DEFAULT:[e]}},Show:function(t,e,i){const s=this.editor.GetBxTag(e);if(s.tag==="diskfile0"){return}this.savedRange=this.editor.selection.GetBookmark();this.Hide();this.editor.contextMenuShown=true;if(this.contextMenuShownTimeout){this.contextMenuShownTimeout=clearTimeout(this.contextMenuShownTimeout)}this.nodes=[];this.tagIndex={};var o,n,a,r,l,h,d,c=[],u=20,p=0,m=e,f;this.targetItems={};while(true){if(m.nodeName&&m.nodeName.toUpperCase()!="BODY"){if(m.nodeType!=3){o=this.editor.GetBxTag(m);if(o&&o.tag=="surrogate_dd"){var b=this.editor.GetBxTag(o.params.origId);m=this.editor.GetIframeElement(b.id);this.PushTargetItem(b.tag,{element:m,bxTag:b});this.nodes=[m];this.tagIndex[b.tag]=0;p=0;m=m.parentNode;continue}else if(o&&o.tag&&this.items[o.tag]){this.nodes=[m];this.PushTargetItem(o.tag,{element:m,bxTag:o.tag});this.nodes=[m];this.tagIndex[o.tag]=0;p=0;m=m.parentNode;continue}f=m.nodeName;this.PushTargetItem(f,m);this.nodes.push(m);this.tagIndex[f]=this.nodes.length-1}p++}if(!m||m.nodeName&&m.nodeName.toUpperCase()=="BODY"||p>=u){break}m=m.parentNode}for(n in this.items){if(this.items.hasOwnProperty(n)&&this.tagIndex[n]!=undefined){if(c.length>0){c.push({SEPARATOR:true})}for(a=0;a<this.items[n].length;a++){if(typeof this.items[n][a].HIDE_ITEM=="function"&&this.items[n][a].HIDE_ITEM()===true)continue;if(this.editor.bbCode&&!this.items[n][a].bbMode)continue;if(this.items[n][a].MENU){d=BX.clone(this.items[n][a]);l=[];for(r=0;r<d.MENU.length;r++){h=d.MENU[r];if(typeof h.HIDE_ITEM=="function"&&h.HIDE_ITEM()===true)continue;if(this.editor.bbCode&&!h.bbMode)continue;l.push(h)}if(l.length===0)continue;d.MENU=l;c.push(d)}else{c.push(this.items[n][a])}}}}if(c.length==0&&(!this.editor.bbCode||this.items["DEFAULT"].bbMode)){if(!this.savedRange||!this.savedRange.collapsed&&!i){for(a=0;a<this.items["DEFAULT"].length;a++){c.push(this.items["DEFAULT"][a])}}}var C=t.clientX,g=t.clientY;if(!this.dummyTarget){this.dummyTarget=this.editor.dom.iframeCont.appendChild(BX.create("DIV",{props:{className:"bxhtmled-dummy-target"}}))}this.dummyTarget.style.left=C+"px";this.dummyTarget.style.top=g+"px";this.dummyTarget.style.zIndex="2002";if(c.length>0){this.OPENER=new BX.COpener({DIV:this.dummyTarget,MENU:c,TYPE:"click",ACTIVE_CLASS:"adm-btn-active",CLOSE_ON_CLICK:true});this.OPENER.Open();var B=this.OPENER.GetMenu().DIV;B.id="bx-admin-prefix";BX.addClass(B,"bx-core-popup-menu-editor");this.isOpened=true;BX.addCustomEvent(this.editor,"OnIframeClick",BX.proxy(this.Hide,this));BX.addCustomEvent(this.editor,"OnIframeKeyup",BX.proxy(this.CheckEscapeClose,this));return BX.PreventDefault(t)}},Hide:function(){if(this.OPENER){var t=this;this.contextMenuShownTimeout=setTimeout((function(){t.editor.contextMenuShown=false}),300);this.OPENER.bMenuInit=true;this.OPENER.Close();this.isOpened=false;BX.removeCustomEvent(this.editor,"OnIframeClick",BX.proxy(this.Hide,this));BX.removeCustomEvent(this.editor,"OnIframeKeyup",BX.proxy(this.CheckEscapeClose,this))}},CheckEscapeClose:function(t,e){if(e==this.editor.KEY_CODES["escape"])this.Hide()},GetTargetItem:function(t){return t?this.targetItems[t]||null:this.targetItems},PushTargetItem:function(t,e){if(!this.targetItems[t])this.targetItems[t]=e}};function n(t,e){this.editor=t;this.pCont=t.dom.toolbar;this.controls={};this.bCompact=false;this.topControls=e;this.showMoreButton=false;this.shown=true;this.height=null;this.Init()}n.prototype={Init:function(){this.BuildControls();BX.addCustomEvent(this.editor,"OnIframeFocus",BX.delegate(this.EnableWysiwygButtons,this));BX.addCustomEvent(this.editor,"OnTextareaFocus",BX.delegate(this.DisableWysiwygButtons,this));BX.bind(this.pCont,"scroll",BX.proxy(this.SetScrollShadows,this))},SetScrollShadows:function(){const t=this.pCont.scrollWidth;const e=this.pCont.offsetWidth;let i=this.pCont.scrollLeft;let s=t-e-i;if(s<0){i+=s;s=0}if(i>20&&s>20){this.pCont.parentNode.classList.remove("has-tools-on-left");this.pCont.parentNode.classList.remove("has-tools-on-right");this.pCont.parentNode.classList.add("has-tools-on-sides")}else if(i>20){this.pCont.parentNode.classList.add("has-tools-on-left");this.pCont.parentNode.classList.remove("has-tools-on-right");this.pCont.parentNode.classList.remove("has-tools-on-sides")}else if(s>20){this.pCont.parentNode.classList.remove("has-tools-on-left");this.pCont.parentNode.classList.add("has-tools-on-right");this.pCont.parentNode.classList.remove("has-tools-on-sides")}else if(i<20&&s<20){this.pCont.parentNode.classList.remove("has-tools-on-left");this.pCont.parentNode.classList.remove("has-tools-on-right");this.pCont.parentNode.classList.remove("has-tools-on-sides")}},BuildControls:function(){BX.cleanNode(this.pCont);var t,e,i,s,o=this.GetControlsMap(),n={left:this.pCont.appendChild(BX.create("span",{props:{className:"bxhtmled-top-bar-left-wrap"},style:{display:"none"}})),main:this.pCont.appendChild(BX.create("span",{props:{className:"bxhtmled-top-bar-wrap"},style:{display:"none"}})),right:this.pCont.appendChild(BX.create("span",{props:{className:"bxhtmled-top-bar-right-wrap"},style:{display:"none"}})),hidden:this.pCont.appendChild(BX.create("span",{props:{className:"bxhtmled-top-bar-hidden-wrap"}}))};this.hiddenWrap=n.hidden;this.editor.normalWidth=this.editor.NORMAL_WIDTH;for(t=0;t<o.length;t++){if(o[t].hidden){o[t].wrap="hidden";this.showMoreButton=true}else if(o[t].checkWidth&&o[t].offsetWidth){this.editor.normalWidth+=o[t].offsetWidth}e=n[o[t].wrap||"main"];if(!e){e=BX(o[t].wrap);if(e){n[o[t].wrap]=e}else{e=n["main"]}}if(e.style.display=="none")e.style.display="";if(o[t].separator){e.appendChild(this.GetSeparator())}else if(this.topControls[o[t].id]){if(!this.controls[o[t].id]){this.controls[o[t].id]=new this.topControls[o[t].id](this.editor,e)}else{s=this.controls[o[t].id].GetPopupBindCont?this.controls[o[t].id].GetPopupBindCont():this.controls[o[t].id].GetCont();if(this.controls[o[t].id].CheckBeforeShow&&!this.controls[o[t].id].CheckBeforeShow())continue;if(this.controls.More&&(this.bCompact&&!o[t].compact||o[t].hidden)){if(!i){i=this.controls.More.GetPopupCont()}i.appendChild(s)}else{e.appendChild(s)}}}}for(t in n){if(n.hasOwnProperty(t)&&t!=="main"&&t!=="left"&&t!=="right"&&t!=="hidden"&&n[t].getAttribute("data-bx-check-command")!=="N"){n[t].setAttribute("data-bx-check-command","N");BX.bind(n[t],"click",BX.proxy((function(t){this.editor.CheckCommand(t.target||t.srcElement)}),this))}}},GetControlsMap:function(){if(this.controlsMap)return this.controlsMap;var t=this.editor.config.controlsMap;if(!t){t=[{id:"ChangeView",wrap:"left",compact:true,sort:10},{id:"Undo",compact:false,sort:20},{id:"Redo",compact:false,sort:30},{id:"StyleSelector",compact:true,sort:40},{id:"FontSelector",compact:false,sort:50},{id:"FontSize",compact:false,sort:60},{separator:true,compact:false,sort:70},{id:"Bold",compact:true,sort:80},{id:"Italic",compact:true,sort:90},{id:"Underline",compact:true,sort:100},{id:"Strikeout",compact:true,sort:110},{id:"RemoveFormat",compact:true,sort:120},{id:"Color",compact:true,sort:130},{separator:true,compact:false,sort:140},{id:"OrderedList",compact:true,sort:150},{id:"UnorderedList",compact:true,sort:160},{id:"IndentButton",compact:true,sort:170},{id:"OutdentButton",compact:true,sort:180},{id:"AlignList",compact:true,sort:190},{separator:true,compact:false,sort:200},{id:"InsertLink",compact:true,sort:210},{id:"InsertImage",compact:true,sort:220},{id:"InsertVideo",compact:true,sort:230},{id:"InsertAnchor",compact:false,sort:240},{id:"InsertTable",compact:false,sort:250},{id:"InsertChar",compact:false,hidden:true,sort:260},{id:"PrintBreak",compact:false,hidden:true,sort:270},{id:"PageBreak",compact:false,hidden:true,sort:275},{id:"Spellcheck",compact:false,hidden:true,sort:280},{id:"InsertHr",compact:false,hidden:true,sort:290},{id:"Sub",compact:false,hidden:true,sort:310},{id:"Sup",compact:false,hidden:true,sort:320},{id:"TemplateSelector",compact:false,sort:330},{id:"Fullscreen",compact:true,sort:340},{id:"More",compact:true,sort:400},{id:"Settings",wrap:"right",compact:true,sort:500}]}this.editor.On("GetControlsMap",[t]);t=t.sort((function(t,e){return t.sort-e.sort}));this.controlsMap=t;return t},GetSeparator:function(){return BX.create("span",{props:{className:"bxhtmled-top-bar-separator"}})},GetHeight:function(){var t=0;if(this.shown){if(!this.height)this.height=parseInt(this.editor.dom.toolbarCont.offsetHeight);t=this.height}return t},DisableWysiwygButtons:function(t){t=t!==false;for(var e in this.controls){if(this.controls.hasOwnProperty(e)&&typeof this.controls[e].Disable=="function"&&this.controls[e].disabledForTextarea!==false)this.controls[e].Disable(t)}},EnableWysiwygButtons:function(){this.DisableWysiwygButtons(false)},AdaptControls:function(t){this.SetScrollShadows();var e=t<this.editor.normalWidth;if(this.controls.More){if(e||this.showMoreButton){this.controls.More.GetCont().style.display=""}else{this.controls.More.GetCont().style.display="none"}if(this.controls.More.pCont&&this.controls.More.pCont.style.display!=="none")this.controls.More.Close()}if(!e&&this.showMoreButton){var i=this.controls.More.GetPopupCont();while(this.hiddenWrap.firstChild){i.appendChild(this.hiddenWrap.firstChild)}}if(this.bCompact!=e){this.bCompact=e;this.BuildControls()}},Hide:function(){this.shown=false;this.editor.dom.toolbarCont.style.display="none";this.editor.ResizeSceleton()},Show:function(){this.shown=true;this.editor.dom.toolbarCont.style.display="";this.editor.ResizeSceleton()},IsShown:function(){return this.shown}};function a(t){this.editor=t;this.bShown=false;this.pCont=t.dom.navCont;this.controls={};this.height=28;this.Init()}a.prototype={Init:function(){BX.addCustomEvent(this.editor,"OnIframeMouseDown",BX.proxy(this.OnIframeMousedown,this));BX.addCustomEvent(this.editor,"OnIframeKeyup",BX.proxy(this.OnIframeKeyup,this));BX.addCustomEvent(this.editor,"OnTextareaFocus",BX.delegate(this.Disable,this));BX.addCustomEvent(this.editor,"OnHtmlContentChangedByControl",BX.delegate(this.OnIframeKeyup,this));BX.bind(this.pCont,"click",BX.delegate(this.ShowMenu,this));var t=this;this.items={php:function(e,i){t.editor.GetDialog("Source").Show(i)},anchor:function(e,i){t.editor.GetDialog("Anchor").Show(i)},javascript:function(e,i){t.editor.GetDialog("Source").Show(i)},htmlcomment:function(e,i){t.editor.GetDialog("Source").Show(i)},iframe:function(e,i){t.editor.GetDialog("Source").Show(i)},style:function(e,i){t.editor.GetDialog("Source").Show(i)},video:function(e,i){t.editor.GetDialog("Video").Show(i)},component:function(e,i){t.editor.components.ShowPropertiesDialog(i.params,t.editor.GetBxTag(i.surrogateId))},printbreak:false,A:function(e){t.editor.GetDialog("Link").Show([e])},IMG:function(e){t.editor.GetDialog("Image").Show([e])},TABLE:function(e){t.editor.GetDialog("Table").Show([e])},DEFAULT:function(e){t.editor.GetDialog("Default").Show([e])}}},Show:function(t){this.bShown=t=t!==false;this.pCont.style.display=t?"block":"none"},GetHeight:function(){if(!this.bShown)return 0;if(!this.height)this.height=parseInt(this.pCont.offsetHeight);return this.height},OnIframeMousedown:function(t,e,i){this.BuildNavi(e)},OnIframeKeyup:function(t,e,i){this.BuildNavi(i)},BuildNavi:function(t){BX.cleanNode(this.pCont);if(!t){t=this.editor.GetIframeDoc().body}this.nodeIndex=[];var e,i,s;while(t){if(t.nodeType!=3){s=this.editor.GetBxTag(t);if(s.tag){if(s.tag=="surrogate_dd"){t=t.parentNode;continue}BX.cleanNode(this.pCont);this.nodeIndex=[];i=s.name||s.tag}else{i=t.nodeName}e=BX.create("SPAN",{props:{className:"bxhtmled-nav-item"},text:i});e.setAttribute("data-bx-node-ind",this.nodeIndex.length.toString());this.nodeIndex.push({node:t,bxTag:s.tag});if(this.pCont.firstChild){this.pCont.insertBefore(e,this.pCont.firstChild);if(!this.AdjustSize()){break}}else{this.pCont.appendChild(e)}}if(t.nodeName&&t.nodeName.toUpperCase()=="BODY"){break}t=t.parentNode}this.AdjustSize()},AdjustSize:function(){if(this.pCont.lastChild&&this.pCont.lastChild.offsetTop>0){BX.remove(this.pCont.firstChild);return false}return true},ShowMenu:function(t){if(!this.nodeIndex){return}var e=this,i,s,o;if(t.target){o=t.target}else if(t.srcElement){o=t.srcElement}if(o.nodeType==3){o=o.parentNode}if(o){i=o.getAttribute("data-bx-node-ind");if(!this.nodeIndex[i]){o=BX.findParent(o,(function(t){return t==e.pCont||t.getAttribute&&t.getAttribute("data-bx-node-ind")>=0}),this.pCont);i=o.getAttribute("data-bx-node-ind")}if(this.nodeIndex[i]){var n="bx_node_nav_"+Math.round(Math.random()*1e9);s=this.nodeIndex[i].node;var a=[];if(s.nodeName&&s.nodeName.toUpperCase()!="BODY"){if(!this.nodeIndex[i].bxTag||!this.editor.phpParser.surrogateTags[this.nodeIndex[i].bxTag]){a.push({text:BX.message("NodeSelect"),title:BX.message("NodeSelect"),className:"",onclick:function(){e.editor.action.Exec("selectNode",s);this.popupWindow.close();this.popupWindow.destroy()}})}a.push({text:BX.message("NodeRemove"),title:BX.message("NodeRemove"),className:"",onclick:function(){if(s&&s.parentNode){e.BuildNavi(s.parentNode);e.editor.selection.RemoveNode(s)}this.popupWindow.close();this.popupWindow.destroy()}});var r=!(this.nodeIndex[i]&&this.nodeIndex[i].bxTag&&this.items[this.nodeIndex[i].bxTag]==false);if(r){a.push({text:BX.message("NodeProps"),title:BX.message("NodeProps"),className:"",onclick:function(){e.ShowNodeProperties(s);this.popupWindow.close();this.popupWindow.destroy()}})}}else{a=[{text:BX.message("NodeSelectBody"),title:BX.message("NodeSelectBody"),className:"",onclick:function(){e.editor.iframeView.CheckContentLastChild();e.editor.action.Exec("selectNode",s);e.editor.Focus();this.popupWindow.close();this.popupWindow.destroy()}},{text:BX.message("NodeRemoveBodyContent"),title:BX.message("NodeRemoveBodyContent"),className:"",onclick:function(){e.BuildNavi(s);e.editor.On("OnHtmlContentChangedByControl");e.editor.iframeView.Clear();e.editor.util.Refresh(s);e.editor.synchro.FullSyncFromIframe();e.editor.Focus();this.popupWindow.close();this.popupWindow.destroy()}}]}BX.PopupMenu.show(n+"_menu",o,a,{overlay:{opacity:1},events:{onPopupClose:function(){}},offsetLeft:1,zIndex:4e3,bindOptions:{position:"top"}})}}},ShowNodeProperties:function(t){var e,i;if(t.nodeName&&t.nodeType==1){e=this.editor.GetBxTag(t);i=e.tag?e.tag:t.nodeName;if(this.items[i]&&typeof this.items[i]=="function"){this.items[i](t,e)}else{this.items["DEFAULT"](t,e)}}},Disable:function(){this.BuildNavi(false)},Enable:function(){}};function r(t,e){this.editor=t;this.id="bxeditor_overlay"+this.editor.id;this.zIndex=e&&e.zIndex?e.zIndex:1001}r.prototype={Create:function(){this.bCreated=true;this.bShown=false;var t=BX.GetWindowScrollSize();this.pWnd=document.body.appendChild(BX.create("DIV",{props:{id:this.id,className:"bxhtmled-overlay"},style:{width:t.scrollWidth+"px",height:t.scrollHeight+"px"}}));this.pWnd.ondrag=BX.False;this.pWnd.onselectstart=BX.False},Show:function(t){if(!this.bCreated)this.Create();this.bShown=true;if(this.shownTimeout){this.shownTimeout=clearTimeout(this.shownTimeout)}var e=BX.GetWindowScrollSize();this.pWnd.style.display="block";this.pWnd.style.width=e.scrollWidth+"px";this.pWnd.style.height=e.scrollHeight+"px";if(!t){t={}}this.pWnd.style.zIndex=t.zIndex||this.zIndex;BX.bind(window,"resize",BX.proxy(this.Resize,this));return this.pWnd},Hide:function(){if(!this.bShown){return}var t=this;t.shownTimeout=setTimeout((function(){t.bShown=false}),300);this.pWnd.style.display="none";BX.unbind(window,"resize",BX.proxy(this.Resize,this));this.pWnd.onclick=null},Resize:function(){if(this.bCreated){var t=BX.GetWindowScrollSize();this.pWnd.style.width=t.scrollWidth+"px";this.pWnd.style.height=t.scrollHeight+"px"}}};function l(t){this.editor=t;this.className="bxhtmled-top-bar-btn";this.activeClassName="bxhtmled-top-bar-btn-active";this.disabledClassName="bxhtmled-top-bar-btn-disabled";this.checkableAction=true;this.disabledForTextarea=true}l.prototype={Create:function(){this.pCont=BX.create("SPAN",{props:{className:this.className,title:this.title||""},html:"<i></i>"});BX.bind(this.pCont,"click",BX.delegate(this.OnClick,this));BX.bind(this.pCont,"mousedown",BX.delegate(this.OnMouseDown,this));BX.bind(this.pCont,"dblclick",(function(t){return BX.PreventDefault(t)}));if(this.action){this.pCont.setAttribute("data-bx-type","action");this.pCont.setAttribute("data-bx-action",this.action);if(this.value)this.pCont.setAttribute("data-bx-value",this.value);if(this.checkableAction){this.editor.RegisterCheckableAction(this.action,{action:this.action,control:this,value:this.value})}}},GetCont:function(){return this.pCont},Check:function(t){if(t==this.checked||this.disabled)return;this.checked=t;if(this.checked){BX.addClass(this.pCont,this.activeClassName)}else{BX.removeClass(this.pCont,this.activeClassName)}},Disable:function(t){if(t!=this.disabled){this.disabled=!!t;if(t){if(this.action){this.pCont.setAttribute("data-bx-type","")}BX.addClass(this.pCont,this.disabledClassName)}else{if(this.action){this.pCont.setAttribute("data-bx-type","action")}BX.removeClass(this.pCont,this.disabledClassName)}}},OnClick:BX.DoNothing,OnMouseUp:function(){if(!this.checked){BX.removeClass(this.pCont,this.activeClassName)}BX.unbind(document,"mouseup",BX.proxy(this.OnMouseUp,this));BX.removeCustomEvent(this.editor,"OnIframeMouseUp",BX.proxy(this.OnMouseUp,this));if(this.editor.toolbar&&this.editor.toolbar.controls&&this.editor.toolbar.controls.More){this.editor.toolbar.controls.More.Close()}},OnMouseDown:function(){if(!this.disabled){if(this.disabledForTextarea||!this.editor.synchro.IsFocusedOnTextarea()){this.savedRange=this.editor.selection.SaveBookmark()}BX.addClass(this.pCont,this.activeClassName);BX.bind(document,"mouseup",BX.proxy(this.OnMouseUp,this));BX.addCustomEvent(this.editor,"OnIframeMouseUp",BX.proxy(this.OnMouseUp,this))}},GetValue:function(){return!!this.checked},SetValue:function(t){this.Check(t)}};function h(t){this.editor=t;this.className="bxhtmled-top-bar-btn";this.activeClassName="bxhtmled-top-bar-btn-active";this.activeListClassName="bxhtmled-top-bar-btn-active";this.arValues=[];this.checkableAction=true;this.disabledForTextarea=true;this.posOffset={top:6,left:-4};this.zIndex=3005}h.prototype={Create:function(){this.pCont=BX.create("SPAN",{props:{className:this.className},html:"<i></i>"});this.pValuesCont=BX.create("DIV",{props:{className:"bxhtmled-popup bxhtmled-dropdown-cont"},html:'<div class="bxhtmled-popup-corner"></div>'});if(this.title){this.pCont.title=this.title}if(this.zIndex){this.pValuesCont.style.zIndex=this.zIndex}this.valueIndex={};this.pValuesContWrap=this.pValuesCont.appendChild(BX.create("DIV"));var t,e,i=this;for(var s=0;s<this.arValues.length;s++){e=this.arValues[s];t=this.pValuesContWrap.appendChild(BX.create("SPAN",{props:{title:e.title,className:e.className},html:"<i></i>"}));t.setAttribute("data-bx-dropdown-value",e.id);this.valueIndex[e.id]=s;if(e.action){t.setAttribute("data-bx-type","action");t.setAttribute("data-bx-action",e.action);if(e.value){t.setAttribute("data-bx-value",e.value)}}BX.bind(t,"mousedown",(function(t){i.SelectItem(this.getAttribute("data-bx-dropdown-value"));i.editor.CheckCommand(this);i.Close()}));this.arValues[s].listCont=t}if(this.action&&this.checkableAction){this.editor.RegisterCheckableAction(this.action,{action:this.action,control:this})}BX.bind(this.pCont,"click",BX.proxy(this.OnClick,this));BX.bind(this.pCont,"mousedown",BX.delegate(this.OnMouseDown,this))},GetCont:function(){return this.pCont},GetPopupBindCont:function(){return this.pCont},Disable:function(t){if(t!=this.disabled){this.disabled=!!t;if(t){BX.addClass(this.pCont,"bxhtmled-top-bar-btn-disabled")}else{BX.removeClass(this.pCont,"bxhtmled-top-bar-btn-disabled")}}},OnKeyDown:function(t){if(t.keyCode==27){this.Close()}},OnClick:function(){if(!this.disabled){if(this.bOpened){this.Close()}else{this.Open()}}},OnMouseUp:function(){this.editor.selection.RestoreBookmark();if(!this.checked){BX.removeClass(this.pCont,this.activeClassName)}BX.unbind(document,"mouseup",BX.proxy(this.OnMouseUp,this));BX.removeCustomEvent(this.editor,"OnIframeMouseUp",BX.proxy(this.OnMouseUp,this))},OnMouseDown:function(){if(!this.disabled){if(this.disabledForTextarea||!this.editor.synchro.IsFocusedOnTextarea()){this.savedRange=this.editor.selection.SaveBookmark()}BX.addClass(this.pCont,this.activeClassName);BX.bind(document,"mouseup",BX.proxy(this.OnMouseUp,this));BX.addCustomEvent(this.editor,"OnIframeMouseUp",BX.proxy(this.OnMouseUp,this))}},Close:function(){var t=this;this.popupShownTimeout=setTimeout((function(){t.editor.popupShown=false}),300);BX.removeClass(this.pCont,this.activeClassName);this.pValuesCont.style.display="none";this.editor.overlay.Hide();BX.unbind(window,"keydown",BX.proxy(this.OnKeyDown,this));BX.unbind(document,"mousedown",BX.proxy(this.CheckClose,this));BX.onCustomEvent(this,"OnPopupClose");this.bOpened=false},CheckClose:function(t){if(!this.bOpened){return BX.unbind(document,"mousedown",BX.proxy(this.CheckClose,this))}var e;if(t.target)e=t.target;else if(t.srcElement)e=t.srcElement;if(e.nodeType==3)e=e.parentNode;if(!BX.findParent(e,{className:"bxhtmled-popup"})){this.Close()}},Open:function(){this.editor.popupShown=true;if(this.popupShownTimeout){this.popupShownTimeout=clearTimeout(this.popupShownTimeout)}var t=this.pValuesCont.parentNode===null;document.body.appendChild(this.pValuesCont);if(t){BX.ZIndexManager.register(this.pValuesCont)}var e=BX.ZIndexManager.bringToFront(this.pValuesCont);var i=e.getZIndex();this.pValuesCont.style.display="block";BX.addClass(this.pCont,this.activeClassName);var s=this.editor.overlay.Show({zIndex:i-1}),o=this.GetPopupBindCont(),n=BX.pos(o),a=Math.round(n.left-this.pValuesCont.offsetWidth/2+o.offsetWidth/2+this.posOffset.left),r=Math.round(n.bottom+this.posOffset.top),l=this;BX.bind(window,"keydown",BX.proxy(this.OnKeyDown,this));s.onclick=function(){l.Close()};this.pValuesCont.style.top=r+"px";this.pValuesCont.style.left=a+"px";this.bOpened=true;setTimeout((function(){BX.bind(document,"mousedown",BX.proxy(l.CheckClose,l))}),100)},SelectItem:function(t,e){if(!e)e=this.arValues[this.valueIndex[t]];if(this.lastActiveItem)BX.removeClass(this.lastActiveItem,this.activeListClassName);if(e){if(e.listCont){this.lastActiveItem=e.listCont;BX.addClass(e.listCont,this.activeListClassName)}this.pCont.className=e.className;this.pCont.title=BX.util.htmlspecialchars(e.title||e.name||"")}else{this.pCont.className=this.className;this.pCont.title=this.title}if(this.disabled){this.disabled=false;this.Disable(true)}return e},SetValue:function(){},GetValue:function(){},OnPopupClose:function(){}};function d(t){d.superclass.constructor.apply(this,arguments);this.className="bxhtmled-top-bar-select";this.itemClassName="bxhtmled-dd-list-item";this.activeListClassName="bxhtmled-dd-list-item-active";this.disabledForTextarea=true}BX.extend(d,h);d.prototype.Create=function(){this.pCont=BX.create("SPAN",{props:{className:this.className,title:this.title},attrs:{unselectable:"on"},text:""});if(this.width)this.pCont.style.width=this.width+"px";this.pValuesCont=BX.create("DIV",{props:{className:"bxhtmled-popup bxhtmled-dropdown-list-cont"},html:'<div class="bxhtmled-popup-corner"></div>'});this.pValuesContWrap=this.pValuesCont.appendChild(BX.create("DIV",{props:{className:"bxhtmled-dd-list-wrap"}}));this.valueIndex={};if(this.zIndex){this.pValuesCont.style.zIndex=this.zIndex}var t,e,i=this,s,o,n;for(o=0;o<this.arValues.length;o++){e=this.arValues[o];s=this.itemClassName;if(e.className)s+=" "+e.className;n=e.tagName?"<"+e.tagName+">"+e.name+"</"+e.tagName+">":e.name;t=this.pValuesContWrap.appendChild(BX.create("SPAN",{props:{title:e.title||e.name,className:s},html:n,style:e.style}));t.setAttribute("data-bx-dropdown-value",e.id);this.valueIndex[e.id]=o;if(e.defaultValue)this.SelectItem(null,e);if(e.action){t.setAttribute("data-bx-type","action");t.setAttribute("data-bx-action",e.action);if(e.value)t.setAttribute("data-bx-value",e.value)}BX.bind(t,"mousedown",(function(t){if(!t)t=window.event;i.SelectItem(this.getAttribute("data-bx-dropdown-value"));i.editor.CheckCommand(this)}));this.arValues[o].listCont=t}if(this.action&&this.checkableAction){this.editor.RegisterCheckableAction(this.action,{action:this.action,control:this})}BX.bind(this.pCont,"click",BX.proxy(this.OnClick,this))};d.prototype.SelectItem=function(t,e,i){i=i!==false;if(!e){e=this.arValues[this.valueIndex[t]]}if(this.lastActiveItem){BX.removeClass(this.lastActiveItem,this.activeListClassName)}if(e){this.pCont.innerHTML=BX.util.htmlspecialchars(e.topName||e.name||e.id);this.pCont.title=this.title+": "+BX.util.htmlspecialchars(e.title||e.name);if(e.listCont){this.lastActiveItem=e.listCont;BX.addClass(e.listCont,this.activeListClassName)}}if(this.bOpened&&i){this.Close()}};d.prototype.SetValue=function(t,e){};d.prototype.SetWidth=function(t){t=parseInt(t,10);if(t){this.width=t;this.pCont.style.width=t+"px"}};d.prototype.Disable=function(t){if(t!=this.disabled){this.disabled=!!t;if(t){BX.addClass(this.pCont,"bxhtmled-top-bar-select-disabled")}else{BX.removeClass(this.pCont,"bxhtmled-top-bar-select-disabled")}}};function c(t,e){this.values=[];this.pInput=e.input;this.editor=t;this.value=e.value||"";this.defaultValue=e.defaultValue||"";this.posOffset={top:8,left:-4};this.zIndex=3010;this.SPLIT_SYMBOL=",";this.itemClassName="bxhtmled-dd-list-item";this.itemClassNameActive="bxhtmled-dd-list-item-active"}c.prototype={Init:function(){BX.bind(this.pInput,"focus",BX.proxy(this.Focus,this));BX.bind(this.pInput,"click",BX.proxy(this.Focus,this));BX.bind(this.pInput,"blur",BX.proxy(this.Blur,this));BX.bind(this.pInput,"keyup",BX.proxy(this.KeyUp,this));this.visibleItemsLength=this.values.length;this.currentItem=false},UpdateValues:function(t){this.bCreated=false;this.values=t;this.visibleItemsLength=this.values.length;this.currentItem=false;if(this.bOpened){this.ClosePopup()}},Create:function(){this.pValuesCont=BX.create("DIV",{props:{className:"bxhtmled-popup bxhtmled-combo-cont"},html:'<div class="bxhtmled-popup-corner"></div>'});this.pValuesCont.style.zIndex=this.zIndex;if(this.pValuesContWrap){BX.cleanNode(this.pValuesContWrap);this.pValuesCont.appendChild(this.pValuesContWrap)}else{this.pValuesContWrap=this.pValuesCont.appendChild(BX.create("DIV",{props:{className:"bxhtmled-dd-list-wrap"}}));BX.bind(this.pValuesContWrap,"mousedown",(function(t){var e=t.target||t.srcElement;if(!e.getAttribute("data-bx-dropdown-value")){e=BX.findParent(e,(function(t){return t.getAttribute&&t.getAttribute("data-bx-dropdown-value")}),i.pValuesContWrap)}if(e){i.currentItem=parseInt(e.getAttribute("data-bx-dropdown-value"),10);i.SetValueFromList()}i.ClosePopup()}))}this.valueIndex={};var t,e,i=this,s,o,n;for(o=0;o<this.values.length;o++){e=this.values[o];s=this.itemClassName||"";this.values[o].TITLE=this.values[o].TITLE||this.values[o].NAME;if(this.values[o].VALUE&&this.values[o].VALUE!==this.values[o].TITLE){this.values[o].TITLE+=" ("+this.values[o].VALUE+")"}else{this.values[o].VALUE=this.values[o].NAME}t=this.pValuesContWrap.appendChild(BX.create("SPAN",{props:{className:s},html:e.TITLE}));t.setAttribute("data-bx-dropdown-value",o);this.values[o].cont=t}this.bCreated=true},KeyUp:function(t){var e=t.keyCode;if(e==this.editor.KEY_CODES["down"]){this.SelectItem(1)}else if(e==this.editor.KEY_CODES["up"]){this.SelectItem(-1)}else if(e==this.editor.KEY_CODES["escape"]){if(this.bOpened){this.ClosePopup();return BX.PreventDefault(t)}}else if(e==this.editor.KEY_CODES["enter"]){if(this.bOpened){this.SetValueFromList();this.ClosePopup();return BX.PreventDefault(t)}}else{this.FilterValue()}},FilterValue:function(){var t,e,i=this.GetSplitedValues(),s=this.GetCaretPos(this.pInput);for(t=0;t<i.length;t++){e=i[t];if(s>=e.start&&s<=e.end){break}}this.FilterAndHighlight(e.value)},GetSplitedValues:function(){var t,e,i,s,o,n=[],a=this.pInput.value;if(a.indexOf(this.SPLIT_SYMBOL)===-1||this.bMultiple===false){n.push({start:0,end:a.length,value:BX.util.trim(a)})}else{t=a.split(this.SPLIT_SYMBOL);i=0;s=0;for(e=0;e<t.length;e++){o=t[e];s+=o.length+e;n.push({start:i,end:s,value:BX.util.trim(o)});i=s}}return n},FilterAndHighlight:function(t){t=BX.util.trim(t);var e,i,s=false,o;this.visibleItemsLength=0;for(i=0;i<this.values.length;i++){e=this.values[i];if(t===""){s=true;e.cont.style.display="";this.visibleItemsLength++}else{o=e.TITLE.toLowerCase().indexOf(t.toLowerCase());if(o!==-1||t==""){e.cont.innerHTML=BX.util.htmlspecialchars(e.TITLE.substr(0,o))+"<b>"+BX.util.htmlspecialchars(t)+"</b>"+BX.util.htmlspecialchars(e.TITLE.substr(o+t.length));s=true;e.cont.style.display="";e.cont.setAttribute("data-bx-dropdown-value",this.visibleItemsLength);this.visibleItemsLength++}else{e.cont.innerHTML=BX.util.htmlspecialchars(e.TITLE);e.cont.style.display="none"}}}this.currentItem=false;if(s&&!this.bOpened){this.ShowPopup()}else if(!s&&this.bOpened){this.ClosePopup()}},GetCaretPos:function(t){var e=0;if(document.selection){BX.focus(t);var i=document.selection.createRange();i.moveStart("character",-t.value.length);e=i.text.length}else if(t.selectionStart||t.selectionStart=="0"){e=t.selectionStart}return e},SetValue:function(t){this.pInput.value=t},SetValueFromList:function(){var t=0,e,i;for(i=0;i<this.values.length;i++){e=this.values[i];if(e.cont.style.display!="none"){if(t==this.currentItem){BX.addClass(e.cont,this.itemClassNameActive);break}t++}}var s,o=this.GetSplitedValues(),n=this.GetCaretPos(this.pInput);for(i=0;i<o.length;i++){s=o[i];if(n>=s.start&&n<=s.end){break}}var a=this.SPLIT_SYMBOL==" "?" ":this.SPLIT_SYMBOL+" ",r=this.pInput.value,l=r.substr(0,s.start),h=r.substr(s.end);l=l.replace(/^[\s\r\n\,]+/g,"").replace(/[\s\r\n\,]+$/g,"");h=h.replace(/^[\s\r\n\,]+/g,"").replace(/[\s\r\n\,]+$/g,"");this.pInput.value=l+(l==""?"":a)+e.VALUE+(h==""?"":a)+h;this.FilterAndHighlight("")},SelectItem:function(t){var e,i,s,o;if(this.currentItem===false){this.currentItem=0}else if(t!==undefined){this.currentItem+=t;if(this.currentItem>this.visibleItemsLength-1){this.currentItem=0}else if(this.currentItem<0){this.currentItem=this.visibleItemsLength-1}}if(document.querySelectorAll){var n=this.pValuesContWrap.querySelectorAll("."+this.itemClassNameActive);if(n){for(s=0;s<n.length;s++){BX.removeClass(n[s],this.itemClassNameActive)}}}e=0;o=this.values.length;for(s=0;s<this.values.length;s++){i=this.values[s];if(i.cont.style.display!="none"){if(e==this.currentItem){BX.addClass(i.cont,this.itemClassNameActive);break}e++}}},Focus:function(t){if(this.values.length>0&&!this.bFocused){BX.focus(this.pInput);this.bFocused=true;if(this.value==this.defaultValue){this.value=""}this.ShowPopup()}},Blur:function(){if(this.values.length>0&&this.bFocused){this.bFocused=false;this.ClosePopup()}},ShowPopup:function(){if(!this.bCreated){this.Create()}this.editor.popupShown=true;if(this.popupShownTimeout){this.popupShownTimeout=clearTimeout(this.popupShownTimeout)}var t=this.pValuesCont.parentNode===null;document.body.appendChild(this.pValuesCont);if(t){BX.ZIndexManager.register(this.pValuesCont)}BX.ZIndexManager.bringToFront(this.pValuesCont);this.pValuesCont.style.display="block";var e,i=BX.pos(this.pInput),s=i.left+this.posOffset.left,o=i.bottom+this.posOffset.top;this.pValuesCont.style.top=o+"px";this.pValuesCont.style.left=s+"px";this.bOpened=true;if(document.querySelectorAll){var n=this.pValuesContWrap.querySelectorAll("."+this.itemClassNameActive);if(n){for(e=0;e<n.length;e++){BX.removeClass(n[e],this.itemClassNameActive)}}}BX.onCustomEvent(this,"OnComboPopupOpen")},ClosePopup:function(){var t=this;this.popupShownTimeout=setTimeout((function(){t.editor.popupShown=false}),300);this.pValuesCont.style.display="none";this.editor.overlay.Hide();this.bOpened=false;BX.onCustomEvent(this,"OnComboPopupClose")},OnChange:function(){},CheckClose:function(t){if(!this.bOpened){return BX.unbind(document,"mousedown",BX.proxy(this.CheckClose,this))}var e;if(t.target)e=t.target;else if(t.srcElement)e=t.srcElement;if(e.nodeType==3)e=e.parentNode;if(!BX.findParent(e,{className:"bxhtmled-popup"}))this.Close()}};function u(t,e){u.superclass.constructor.apply(this,arguments);this.filterTag=e.filterTag||"";this.lastTemplateId=this.editor.GetTemplateId();this.values=this.GetClasses();this.SPLIT_SYMBOL=" ";this.Init()}BX.extend(u,c);u.prototype.OnChange=function(){if(this.lastTemplateId!=this.editor.GetTemplateId()){this.lastTemplateId=this.editor.GetTemplateId();this.values=this.GetClasses();this.bCreated=false}};u.prototype.GetClasses=function(){var t,e=this.editor.GetCurrentCssClasses(this.filterTag);this.values=[];if(e&&e.length>0){for(var i=0;i<e.length;i++){t=null;if(e[i].classTitle&&typeof e[i].classTitle=="object"){if(e[i].classTitle.title){t=e[i].classTitle.title}else{continue}}else if(e[i].classTitle){t=e[i].classTitle}this.values.push({VALUE:e[i].className,TITLE:t,NAME:e[i].className})}}return this.values};function p(t){this.editor=t;if(this.editor.config.pasteSetColors!==this.editor.config.pasteSetBorders||this.editor.config.pasteSetColors!==this.editor.config.pasteSetDecor){this.mode="default"}else{this.mode=this.editor.config.pasteSetColors&&this.editor.config.pasteSetBorders&&this.editor.config.pasteSetDecor?"text":"rich"}var e=this;this.items=[];if(this.mode=="default"){this.items=[{TEXT:BX.message("BXEdPasteDefault"),ACTION:function(){e.Hide("default")},CHECKED:this.mode=="default",_MODE:"default"}]}this.items.push({TEXT:BX.message("BXEdPasteText"),ACTION:function(){e.Hide("text")},CHECKED:this.mode=="text",_MODE:"text"});this.items.push({TEXT:BX.message("BXEdPasteFormattedText"),ACTION:function(){e.Hide("rich")},CHECKED:this.mode=="rich",_MODE:"rich"});BX.addCustomEvent("OnComponentParamsDisplay",BX.proxy(this.Hide,this))}p.prototype={CheckAndShow:function(){var t=this.isOpened,e=this;this.savedRange=this.editor.selection.GetBookmark();this.isOpened=true;this.lastPreviewMode=false;if(this.checkTimeout)this.checkTimeout=clearTimeout(this.checkTimeout);this.checkTimeout=setTimeout((function(){var i=e.editor.skipPasteHandler;e.editor.skipPasteHandler=true;e.PreviewContent({mode:"rich",doTimeout:false,skipColors:true});var s=e.editor.iframeView.GetValue();s=s.replace(/<img((?:\s|\S)*?)>/gi,"");s=s.replace(/id="(\s|\S)*?"/gi,"");s=s.replace(/\s+/gi," ");e.PreviewContent({mode:"text",doTimeout:false});var o=e.editor.iframeView.GetValue();o=o.replace(/<img((?:\s|\S)*?)>/gi,"");o=o.replace(/id="(\s|\S)*?"/gi,"");o=o.replace(/\s+/gi," ");if(s!=o){e.isOpened=t;e.editor.SetCursorNode(e.savedRange);e.Show()}e.editor.skipPasteHandler=i}),200)},Show:function(){var t=this;this.lastPreviewMode=false;this.Hide();this.pOverlay=this.editor.overlay.Show({zIndex:1040});BX.bind(this.pOverlay,"click",BX.proxy(this.Hide,this));BX.bind(this.pOverlay,"mousemove",BX.proxy((function(){this.PreviewContent({mode:"default"})}),this));if(!this.dummyTarget){this.dummyTarget=this.editor.dom.iframeCont.appendChild(BX.create("DIV",{props:{className:"bxhtmled-dummy-target"}}))}var e=this.editor.GetIframeElement("bx-cursor-node"),i=0,s=0,o;if(e){if(e.parentNode){i+=e.offsetHeight;o=e;do{i+=o.offsetTop||0;s+=o.offsetLeft||0;o=o.offsetParent}while(o&&o.nodeName!="BODY")}}var n=BX.GetWindowScrollPos(this.editor.GetIframeDoc());i-=n.scrollTop;s-=n.scrollLeft;var a=this.editor.GetSceletonSize(),r=a.height-this.items.length*40,l=a.width-100;if(i<0)i=0;else if(i>r)i=r;if(s<0)s=0;else if(s>l)s=l;this.dummyTarget.style.left=s+"px";this.dummyTarget.style.top=i+"px";this.dummyTarget.style.zIndex="2002";this.OPENER=new BX.COpener({DIV:this.dummyTarget,MENU:this.items,TYPE:"click",ACTIVE_CLASS:"adm-btn-active",CLOSE_ON_CLICK:true});this.OPENER.Open();var h=this.OPENER.GetMenu().DIV;BX.addClass(h,"bxhtmled-paste-control bx-core-popup-menu-editor");BX.addCustomEvent(this.OPENER.GetMenu(),"onMenuClose",BX.proxy(this.Hide,this));var d,c=BX.findChild(h,{className:"bx-core-popup-menu-item"},1,1);for(d=0;d<c.length;d++){c[d].setAttribute("data-bx-mode",this.items[d]._MODE)}BX.bind(h,"mousemove",(function(e){var i=e.target||e.srcElement,s=i&&i.getAttribute?i.getAttribute("data-bx-mode"):null;if(!s){i=BX.findParent(i,(function(t){return t==h||t.getAttribute&&t.getAttribute("data-bx-mode")}),h);s=i&&i.getAttribute?i.getAttribute("data-bx-mode"):null}t.PreviewContent({mode:s})}));this.isOpened=true;BX.addCustomEvent(this.editor,"OnIframeKeydown",BX.CMenu.broadcastCloseEvent);BX.bind(document.body,"keydown",BX.CMenu.broadcastCloseEvent)},Hide:function(t){if(this.isOpened){this.editor.overlay.Hide();if(this.pOverlay){BX.unbind(this.pOverlay,"click",BX.proxy(this.Hide,this));BX.unbind(this.pOverlay,"mousemove",BX.proxy(this.PreviewContent,this))}BX.removeCustomEvent(this.editor,"OnIframeKeydown",BX.CMenu.broadcastCloseEvent);BX.unbind(document.body,"keydown",BX.CMenu.broadcastCloseEvent);if(!t||typeof t!=="string"||t!=="text"&&t!=="rich")t="default";this.PreviewContent({mode:t});this.editor.Focus();this.editor.On("OnIframePaste");this.editor.On("OnIframeNewWord");this.isOpened=false}},PreviewContent:function(t){if(this.isOpened){if(this.lastPreviewMode!=t.mode||!this.lastPreviewMode){if(t.doTimeout!==false){t.doTimeout=false;var e=this;if(this.previewTimeout)clearTimeout(this.previewTimeout);this.previewTimeout=setTimeout((function(){e.PreviewContent(t)}),200);return}if(t.mode=="rich"){this.editor.config.pasteSetColors=!!t.skipColors;this.editor.config.pasteSetBorders=false;this.editor.config.pasteSetDecor=false}else if(t.mode=="text"){this.editor.config.pasteSetColors=true;this.editor.config.pasteSetBorders=true;this.editor.config.pasteSetDecor=true}else{this.editor.config.pasteSetColors=this.defPasteSetColors;this.editor.config.pasteSetBorders=this.defPasteSetBorders;this.editor.config.pasteSetDecor=this.defPasteSetDecor}this.editor.pasteHandleMode=true;this.editor.bbParseContentMode=true;this.editor.synchro.lastIframeValue=false;this.editor.iframeView.SetValue(this.pastedContent,false);this.editor.synchro.FromIframeToTextarea(true,true);this.editor.pasteHandleMode=false;this.editor.bbParseContentMode=false;this.editor.synchro.lastTextareaValue=false;this.editor.synchro.FromTextareaToIframe(true);this.editor.RestoreCursor();this.editor.skipPasteHandler=false;if(t.mode!="default"){this.editor.config.pasteSetColors=this.defPasteSetColors;this.editor.config.pasteSetBorders=this.defPasteSetBorders;this.editor.config.pasteSetDecor=this.defPasteSetDecor}}this.lastPreviewMode=t.mode}},SaveIframeContent:function(t){this.defPasteSetColors=this.editor.config.pasteSetColors;this.defPasteSetBorders=this.editor.config.pasteSetBorders;this.defPasteSetDecor=this.editor.config.pasteSetDecor;this.pastedContent=t}};function m(){window.BXHtmlEditor.TaskbarManager=t;window.BXHtmlEditor.Taskbar=e;window.BXHtmlEditor.ComponentsControl=i;window.BXHtmlEditor.ContextMenu=o;window.BXHtmlEditor.Dialog=s;window.BXHtmlEditor.Toolbar=n;window.BXHtmlEditor.NodeNavigator=a;window.BXHtmlEditor.Button=l;window.BXHtmlEditor.DropDown=h;window.BXHtmlEditor.DropDownList=d;window.BXHtmlEditor.ComboBox=c;window.BXHtmlEditor.ClassSelector=u;window.BXHtmlEditor.Overlay=r;window.BXHtmlEditor.PasteControl=p;BX.onCustomEvent(window.BXHtmlEditor,"OnEditorBaseControlsDefined")}if(window.BXHtmlEditor){m()}else{BX.addCustomEvent(window,"OnBXHtmlEditorInit",m)}})();
//# sourceMappingURL=html-base-controls.map.js